<?php
// +----------------------------------------------------------------------
// | 知识星球[基于ThinkPHP5开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2018-2019 abcblockchain.io
// +----------------------------------------------------------------------
// | 后台管理使用了HisiPHP
// +----------------------------------------------------------------------
// | Author: abcblockchain.io
// +----------------------------------------------------------------------
namespace app\common\model;

use think\Model;
use think\Db;

/**
 * RedLog模型
 * @package app\common\model
 */
class RedLog extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'ctime';
    protected $updateTime = false;

    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    /**
     * 红包信息
     * @author
     * @param $redId
     * @return array|false|\PDOStatement|string|Model
     */
    public function getList($redId,$startNo = 0, $limit = 10){
        $map = [];
        $map['red_id'] = $redId;
        $map['status'] = 1;
        $startNo = $startNo * $limit;
        $list = $this->where($map)->order('ctime desc')->limit($startNo, $limit)->select();
        foreach($list as $k => $v){
            $list[$k]['mobile'] = substr_replace($v['mobile'],'****',3,4);
        }
        return $list ? $list : [];
    }



}